package org.suk.dp;

import org.suk.dp.cuisine.ICuisine;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 * @description: 调⽤者(⼩⼆)
 * @Date : 2020/12/28 5:30 PM
 * @Author : 石冬冬-Seig Heil
 */
public class Xiaoer {

    private Logger logger = Logger.getLogger(Xiaoer.class.getSimpleName());

    private List<ICuisine> cuisineList = new ArrayList<ICuisine>();

    public void order(ICuisine cuisine) {
        cuisineList.add(cuisine);
    }

    public synchronized void placeOrder() {
        for (ICuisine cuisine : cuisineList) {
            cuisine.cook();
        }
        cuisineList.clear();
    }
}
